﻿using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using GWB.Application.Dome.Dtos;
using GWB.Core;
using GWB.Core.Common.Entity;
using GWB.Core.Enum;
using GWB.Core.TableEntity;
using GWB.Supplier;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace GWB.Application.Dome
{
  

    public class TsetService : SqlSugarDb, ITsetsService, ITransient
    {
        private static SpinLock spin = new SpinLock();

        public async Task<object> Test(long id,int num)
        {
           await TenantDal.Delete(x => x.Name== "大多数");

           await TenantDal.Page(new InputDto()
           {
            Id= "260891014402117"

           });

            // var vvv=  CurrentConsul.ConsulInfo(ConsulService.ServiceA);
            return "";

        }


        public async Task<Result> GetResult()
        {


            throw Oops.Oh(ErrorCodes.P9999, "内部错误");

            var vv = SqlSugarDb.Db.Queryable<User>().First(x => x.Id == 111111111111111);

            var vvv = vv.Id;

            throw Oops.Oh(ErrorCodes.P9999, "dsad");

            return new Core.Result() 
            {
                Data="sssssss"
            
            };

        }

        public async Task<object> GetResult1()
        {
            var vv = SqlSugarDb.Db.Queryable<User>().First(x => x.Id == 111111111111111);

            var vvv = vv.Id;
            var  data = SqlSugarDb.Db.Queryable<User>().ToList();
            //var vvv33 = SqlSugarDb.Db.Insertable(new User()
            //{
            //    Account = "1",
            //    CompanyId = 1,
            //    CreateAt = DateTime.Now,
            //    Id = 20,
            //    TenantId = 1,
            //    Name = "1",
            //    OrgId = 1,
            //    Phone = "1",
            //    Pwd = "1",

            //}).ExecuteCommand();

            

            return new { Code=200, IsSuccess=true, Data=data };
        }

        public async Task<string>  GetStr()
        {
            return "测试";
        }
    }
}
